﻿using SelfMadeMillionaire.Core.Entities;
using SelfMadeMillionaire.Core.Enums;
using SelfMadeMillionaire.Web.Infrastructure.Attributes;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;

namespace SelfMadeMillionaire.Web.Infrastructure.ViewModels.Publications
{
	public class PublicationEditViewModel
	{
        public string SortOrder { get; set; }
		public Publication Publication { get; set; }
		public SelectList ProductTypes { get; set; }
        public List<int> SelectedProducts { get; set; }

		[DisplayName("Min. Access Level")]
		public byte? MinAccessLevel { get; set; }
		public SelectList AccessLevels { get; set; }
		
		[RequiredIf("HtmlContent", null)]
		[DisplayName("File")]
		public HttpPostedFileBase PdfFile { get; set; }
		
		[RequiredIf("PdfFile", null)]
		[DisplayName("HTML Text")]
		public string HtmlContent
		{
			get { return Publication.HtmlContent; }
			set { Publication.HtmlContent = value; }
		}

		[Required]
		[DisplayName("Short Text")]
		[StringLength(4000)]
		public string ShortText
		{
			get { return Publication.ShortText; }
			set { Publication.ShortText = value; }
		}

		public DateTime? StartDate { get; set; }
		public DateTime? EndDate { get; set; }
		public ProductType? SelectedProduct { get; set; }
		public string Title { get; set; }
	}
}
